Quiz 13

Question # 1

Q

Which MySQL statement will delete a table from database and free space in memory while keeping the structure of the table intact?

A)
DELETE FROM TABLE table_name;
B)
DROP TABLE table_name;
C)
TRUNCATE TABLE table_name;

Question # 2

Q

Consider the following queries which give the same result. Pick the most efficient.

A)
SELECT * FROM table_name WHERE col1 = x OR col2 = y;
B)
SELECT * FROM table_name WHERE col1 = x 
UNION ALL 
SELECT * FROM table_name WHERE col2 = y AND col1 != x;
C)
SELECT * FROM table_name WHERE col1 = x 
UNION DISTINCT 
SELECT * FROM table_name WHERE col2 = y;

Question # 3

Q

Which MySQL function assigns a sequential number to each row of a table that starts with one?

A)

ROW_ID()

B)

ROW_NUM()

C)

ROW_NUMBER()

Question # 4

Q

Suppose you perform an UPSERT i.e. a conditional update or insertion into a table. If a row exists, an UPDATE is done and if a row does not exist, an INSERT is performed. Which statement will you use?

A)

MERGE

B)

UPSERT

C)

INSERT with ON DUPLICATE KEY UPDATE

Question # 5

Q

Which option is true for the following statement: The output of a sub-query is dependent on the column values of the parent query table.

A)

Nested sub-query

B)

Correlated sub-query

Quiz 12
Quiz 14
Mark as Completed
Report an Issue